﻿@using ClinicaDentalApp.Models.Horas
@model HorasInputModel
           
@{
    ViewBag.Title = "AgregarHora";
}

<h2>Agregar Hora</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.Rut.js")" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<link href="../../Content/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
    var valido = false;
    $(function () {
        $("#fechaNacimiento").val("");
//        $("#fechaNacimiento").datepicker(
//            {
//                dateFormat: "dd/mm/yy",
//                yearRange: "-90,-1",
//                changeMonth: true,
//                changeYear: true
//            }
        //          );

        $("#fechaNacimiento").datetimepicker({
            ampm: true,
             dateFormat: "dd/mm/yy",
                yearRange: "-90,-1",
                changeMonth: true,
                changeYear: true
        });
            $("#RutPaciente").Rut({
                on_success: function () { valido = true; },
                on_error: function () { alert('Rut incorrecto'); valido = false; }
            });
    });
</script>


@*@{
    var lista = Model.clietes.Select(m=> new {id=m.Rut, name = m.Nombre.Trim() + " " + m.ApellidoPaterno.Trim() + " " + m.ApellidoMaterno.Trim()});  
}*@
<br />
<div class="FormHora">
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
        <div style="float:left;">
            <div class="editor-label">
                @Html.LabelFor(model => model.Nombre)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Nombre)
                @Html.ValidationMessageFor(model => model.Nombre)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.ApellidoPaterno)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.ApellidoPaterno)
                @Html.ValidationMessageFor(model => model.ApellidoPaterno)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.ApellidoMaterno)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.ApellidoMaterno)
                @Html.ValidationMessageFor(model => model.ApellidoMaterno)
            </div>
        </div>
        <div style="float:right;">
            <div class="editor-label">
                @Html.LabelFor(model => model.Rut)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Rut, new { @id = "RutPaciente"})
                @Html.ValidationMessageFor(model => model.Rut)
            </div>
            
            <div class="editor-label">
                @Html.LabelFor(model => model.hora)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.hora, new { @id = "fechaNacimiento", @value = "" })
                @Html.ValidationMessageFor(model => model.hora)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.motivoConsulta)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.motivoConsulta)
                @Html.ValidationMessageFor(model => model.motivoConsulta)
            </div>
        </div>
        <div style="clear:both;">
        </div>
        <p>
            <input type="submit" value="Guardar" />
        </p>
}
<div>
    @Html.ActionLink("Volver a atras", "TomaDeHoras")
</div>
</div>


